package com.ease.plugin.events {
	import com.ease.core.plugin.ResourceBase;
	import com.ease.plugin.pluginClasses.PluginElement;

	import flash.events.Event;


	/**
	 * Event class for events dispatched by a MediaFactory.
	 *
	 *  @langversion 3.0
	 *  @playerversion Flash 10
	 *  @playerversion AIR 1.5
	 *  @productversion OSMF 1.0
	 */
	public class FactoryEvent extends Event
	{
		/**
		 * The MediaFactoryEvent.PLUGIN_LOAD constant defines the value of the
		 * type property of the event object for a pluginLoad event.
		 *
		 * @eventType pluginLoad
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10
		 *  @playerversion AIR 1.5
		 *  @productversion OSMF 1.0
		 */
		public static const PLUGIN_LOAD:String = "pluginLoad";

		/**
		 * The MediaFactoryEvent.PLUGIN_LOAD_ERROR constant defines the value of the
		 * type property of the event object for a pluginLoadError event.
		 *
		 * @eventType pluginLoadError
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10
		 *  @playerversion AIR 1.5
		 *  @productversion OSMF 1.0
		 */
		public static const PLUGIN_LOAD_ERROR:String	= "pluginLoadError";

		/**
		 * The MediaFactoryEvent.MEDIA_ELEMENT_CREATE constant defines the value of the
		 * type property of the event object for a mediaElementCreate event.
		 *
		 * @eventType pluginLoad
		 *
		 *  @langversion 3.0
		 *  @playerversion Flash 10
		 *  @playerversion AIR 1.5
		 *  @productversion OSMF 1.0
		 */
		public static const PLUGIN_ELEMENT_CREATE:String		= "pluginElementCreate";

		public function FactoryEvent(type:String, bubbles:Boolean = false,
                                   cancelable:Boolean = false, resource:ResourceBase = null, pluginElement:PluginElement = null) {
			super(type, bubbles, cancelable);

			_resource = resource;
			_pluginElement = pluginElement;
		}

		public function get resource():ResourceBase {
			return _resource;
		}

		public function get pluginElement():PluginElement {
			return _pluginElement;
		}

		/**
		 * @private
		 */
		override public function clone():Event {
			return new FactoryEvent(type, bubbles, cancelable, _resource);
		}

		private var _resource:ResourceBase;
		private var _pluginElement:PluginElement;
	}
}